import AccountButton from '@/components/settings/AccountButton'; import { getUserByUsername } from '@/lib/api/user'; import { User } from '@/lib/contexts/Auth.context'; interface ProfilePageProps { params: Promise<{ username: string }>; } export default async function Profile({ params }: ProfilePageProps) { const { username } = await params; const profileUser: User = await getUserByUsername(username); const icons = [ 'facebook', 'pinterest', 'discord', 'artstation', 'behance', 'instagram', ] as const; type IconKey = (typeof icons)[number]; return ( <>

{profileUser.username}

{profileUser.profile?.publications_count ?? 0}{' '} публикаций

{profileUser.profile?.collections_count ?? 0}{' '} коллекций

{profileUser.profile?.followers_count ?? 0}{' '} подписчиков

{profileUser.profile?.following_count ?? 0}{' '} подписок

{profileUser.description}

{icons .filter( (icon: IconKey) => profileUser.integrations?.[icon], ) .map((icon: IconKey) => ( {icon} ))}{' '}
); }